-- card: 6552 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 3241 -- name: -- part 1 (field) -- low flags: 80 -- high flags: 0007 -- rect: left=12 top=26 right=298 bottom=491 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 22 -- text size: 10 -- style flags: 0 -- line height: 13 -- part name: Source -- part 2 (button) -- low flags: 00 -- high flags: A003 -- rect: left=314 top=300 right=322 bottom=435 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Show LSP Source ----- HyperTalk script ----- on mouseUp set the visible of card field 1 to not the visible of card field 1 if the visible of card field 1 is true then set the name of me to "Hide LSP Source" else set the name of me to "Show LSP Source" end mouseUp -- part contents for background part 16 ----- text ----- LASTPATHCOMPONENT XFCN version 1.0 March 17, 1988 Kevin Calhoun LastPathComponent takes a pathname and returns the last component of it. The last component is the string of characters following the last colon in the pathname. Examples: put LastPathComponent("HD:My Best Years:1962:The Drive-In") --puts The Drive-In into the message box. put LastPathComponent("Winkin:Blinkin:Nod") into theContainer --puts Nod into theContainer -- part contents for card part 1 ----- text ----- UNIT LastPathComponent; { LastPathComponent XFCN ©1988 by the Trustees of Dartmouth College. } { Written by John K. Calhoun, Courseware Development. } INTERFACE USES XCMDIntf; PROCEDURE Main (paramPtr : XCMDPtr); IMPLEMENTATION PROCEDURE DoJsr (addr : ProcPtr); INLINE $205F, $4E90; PROCEDURE ZeroToPas (paramPtr : XCmdPtr; zeroStr : Ptr; VAR pasStr : Str255); BEGIN WITH paramPtr^ DO BEGIN inArgs[1] := ORD(zeroStr); inArgs[2] := ORD(@pasStr); request := xreqZeroToPas; DoJsr(entryPoint); END; END; FUNCTION PasToZero (paramPtr : XCmdPtr; str : Str255) : Handle; BEGIN WITH paramPtr^ DO BEGIN inArgs[1] := ORD(@str); request := xreqPasToZero; DoJsr(entryPoint); PasToZero := Handle(outArgs[1]); END; END; PROCEDURE GetLPC (paramPtr : XCMDPtr); VAR fullPathName : Str255; fileName : Str255; FUNCTION AfterLastColon (str : Str255) : Str255; VAR theLength, index : INTEGER; BEGIN theLength := LENGTH(str); index := theLength; IF POS(':', str) > 0 THEN BEGIN WHILE (str[index] <> ':') DO BEGIN index := index - 1; END; AfterLastColon := COPY(str, index + 1, theLength - index); END ELSE AfterLastColon := str; END; BEGIN IF paramPtr^.paramCount > 0 THEN BEGIN ZeroToPas(paramPtr, paramPtr^.params[1]^, fullPathName); fileName := AfterLastColon(fullPathName); paramPtr^.returnValue := PasToZero(paramPtr, fileName); END; END; PROCEDURE Main; BEGIN GetLPC(paramPtr); END; END.